import mockjs from "mockjs"

let { money, payInfo } = mockjs.mock({
    "money|1-100": 100,
    "payInfo": "16637634665"
})

export default [
    {
        url: /\/userprofile/,
        method: /get/,
        response: function () {
            return {
                code: 0,
                msg: "用户信息",
                data: {
                    money,
                    payInfo
                }
                // data: {
                //     money: 0,
                //     payInfo:""
                // }
            }
        }
    },
    {
        url: /\/getmoney/,
        method: /post/,
        response: function (option) {
            if (option.body.num > money) {
                return {
                    code: 1,
                    msg: "余额不足，无法进行提现"
                }
            }
            else {
                money -= option.body.num
                return {
                    code: 0,
                    msg: "申请提现成功，3-5小时内到账",
                    data: {
                        money,
                        payInfo
                    }
                }
            }
        }
    },
    {
        url: /\/setpayinfo/,
        method: /post/,
        response: function (option) {
            return {
                code: 0,
                msg: "绑定成功",
                data: {
                    money,
                    payInfo: option.body.payInfo
                }
            }
        }
    }
]